/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author George
 */
@Entity
@Table(name = "SALIDA_ALMACEN", catalog = "BDACCELCOM", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SalidaAlmacen.findAll", query = "SELECT s FROM SalidaAlmacen s"),
    @NamedQuery(name = "SalidaAlmacen.findByNroSalida", query = "SELECT s FROM SalidaAlmacen s WHERE s.nroSalida = :nroSalida"),
    @NamedQuery(name = "SalidaAlmacen.findByFecha", query = "SELECT s FROM SalidaAlmacen s WHERE s.fecha = :fecha"),
    @NamedQuery(name = "SalidaAlmacen.findByDescripcion", query = "SELECT s FROM SalidaAlmacen s WHERE s.descripcion = :descripcion")})
public class SalidaAlmacen implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "NroSalida")
    private Integer nroSalida;
    @Column(name = "Fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Column(name = "Descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nroSalida")
    private List<DetalleSalida> detalleSalidaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nroSalida")
    private List<Venta> ventaList;
    @JoinColumn(name = "IdAlmacen", referencedColumnName = "IdAlmacen")
    @ManyToOne(optional = false)
    private Almacen idAlmacen;

    public SalidaAlmacen() {
    }

    public SalidaAlmacen(Integer nroSalida) {
        this.nroSalida = nroSalida;
    }

    public Integer getNroSalida() {
        return nroSalida;
    }

    public void setNroSalida(Integer nroSalida) {
        this.nroSalida = nroSalida;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public List<DetalleSalida> getDetalleSalidaList() {
        return detalleSalidaList;
    }

    public void setDetalleSalidaList(List<DetalleSalida> detalleSalidaList) {
        this.detalleSalidaList = detalleSalidaList;
    }

    @XmlTransient
    public List<Venta> getVentaList() {
        return ventaList;
    }

    public void setVentaList(List<Venta> ventaList) {
        this.ventaList = ventaList;
    }

    public Almacen getIdAlmacen() {
        return idAlmacen;
    }

    public void setIdAlmacen(Almacen idAlmacen) {
        this.idAlmacen = idAlmacen;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nroSalida != null ? nroSalida.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SalidaAlmacen)) {
            return false;
        }
        SalidaAlmacen other = (SalidaAlmacen) object;
        if ((this.nroSalida == null && other.nroSalida != null) || (this.nroSalida != null && !this.nroSalida.equals(other.nroSalida))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.SalidaAlmacen[ nroSalida=" + nroSalida + " ]";
    }
    
}
